/*
package com;

import com.javabean.Customer;
import com.service.CustomerService;
import com.util.MailUntil;
import com.util.MD5Example;
import com.util.UserInputUtil;

import javax.mail.MessagingException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws MessagingException {

        UserInputUtil user  = new UserInputUtil();
        MailUntil mailUntil = new MailUntil();
        MD5Example md5Example = new MD5Example();

        Scanner sc = new Scanner(System.in);
        CustomerService customerService = new CustomerService();
        System.out.println("------------------欢迎使用客户信息管理系统------------------");
//        System.out.println("--------------------请输入用户账号--------------------");
        System.out.println("是否需要注册新账号:是/否");
        if(sc.next().equals("是")){
            System.out.print("欢迎注册客户信息管理系统,请输入您的qq邮箱：");
            String qq_email = sc.next();
            int send_email = mailUntil.sendemail(qq_email);
            System.out.print("请输入您收到的验证码(若重新发送请输入0)：");
            String receive_qq_email = sc.next();
            if (send_email == 0) {
                System.out.print("欢迎注册客户信息管理系统,请输入您的qq邮箱：");
                qq_email = sc.next();
                send_email= mailUntil.sendemail(qq_email);
            }


            while (true){
                if(send_email == Integer.parseInt(receive_qq_email)){
                    System.out.println("验证成功，请开始输入用户信息");
                    Customer customer = new Customer();
                    System.out.print("姓名:");
                    customer.setNAME(sc.next());
                    System.out.print("性别:");
                    customer.setGender(sc.next());
                    System.out.print("工资:");
                    customer.setSalary(sc.nextDouble());
                    customer.setPhone(user.inputCustomerphonenumber());
                    System.out.print("用户账户:");
                    String username = sc.next();
                    System.out.print("密码:");
                    String password = sc.next();
                    String MD5password = md5Example.md5(password);

                    customer.setUser(username);
                    customer.setPassword(MD5password);

                    customerService.addCustomer(customer);
                    break;
                }else {
                    System.out.println("请输入正确的验证码!");
                    System.out.print("请重新输入：");
                    receive_qq_email = sc.next();
                    if (send_email != Integer.parseInt(receive_qq_email)) {
                        System.out.println("验证成功，请开始输入用户信息");
                        Customer customer = new Customer();
                        System.out.print("姓名:");
                        customer.setNAME(sc.next());
                        System.out.print("性别:");
                        customer.setGender(sc.next());
                        System.out.print("工资:");
                        customer.setSalary(sc.nextDouble());
                        customer.setPhone(user.inputCustomerphonenumber());
                        System.out.print("用户账户:");
                        String username = sc.next();
                        System.out.print("密码:");
                        String password = sc.next();
                        String MD5password = md5Example.md5(password);

                        customer.setUser(username);
                        customer.setPassword(MD5password);

                        customerService.addCustomer(customer);
                        break;
                    }
                }
            }



        }
        System.out.println("------------------欢迎登录客户信息管理系统------------------");
        System.out.print("用户账户:");
        String user1 = sc.next();
//        System.out.println("--------------------请输入用户密码--------------------");
        System.out.print("密码:");
        String password = sc.next();
        String MD5password = md5Example.md5(password);

        for (Customer customer1:customerService.getCustomers(user1)
             ) {
            if(customer1.getUser() .equals(user1)  && customer1.getPassword().equals(MD5password))
            {
                int num = 0;
                do {
                    System.out.println("------------------客户信息管理------------------");
                    System.out.println("--------------------客户列表--------------------");
                    System.out.println("ID\t\t姓名\t\t性别\t\t年龄\t\t工资\t\t电话");
                    for (Customer customer : customerService.getList()) {
                        System.out.println(customer.getId() + "\t\t" + customer.getNAME() + "\t\t" + customer.getGender()
                                + "\t\t" + customer.getAge() + "\t\t" + customer.getSalary() + "\t\t" + customer.getPhone());
                    }
                    System.out.println("----------------------------------------------");

                    System.out.print("1、添加客户 2、修改客户 3、删除客户 4、退出  请输入（1-4）");
                    num = sc.nextInt();
                    switch (num) {
                        case 1:
                            Customer customer = new Customer();

                            System.out.print("姓名:");
                            customer.setNAME(sc.next());
                            System.out.print("性别:");
                            customer.setGender(sc.next());

                            user.inputCustomerage();
//                    System.out.print("年龄:");
//                    boolean validInput = false;
//                    while(!validInput) {
//                        try {
//                            int age = sc.nextInt();
//                            // 这里可以添加额外的验证逻辑，比如检查年龄范围
//                            customer.setAge(age);
//                            validInput = true;
//                        } catch (InputMismatchException e) {
//                            System.out.println("输入无效，请输入一个整数！");
//                            sc.next(); // 清除无效输入，准备下一次读取
//                        }
//                    }
                            System.out.print("工资:");
                            customer.setSalary(sc.nextDouble());
                            customer.setPhone(user.inputCustomerphonenumber());

                            System.out.print("账号:");
                            customer.setUser(sc.next());

                            System.out.print("密码:");
                            customer.setPassword(md5Example.md5(sc.next()));




//                    System.out.print("电话:");
//                    customer.setPhone(sc.next());
                            customerService.addCustomer(customer);
                            break;
                        case 2:
                            Customer customerUpdate = new Customer();
                            System.out.print("要修改的ID:");
                            customerUpdate.setId(sc.nextInt());
                            System.out.print("姓名:");
                            customerUpdate.setNAME(sc.next());
                            System.out.print("性别:");
                            customerUpdate.setGender(sc.next());
                            user.inputCustomerage();

System.out.print("年龄:");
                    customerUpdate.setAge(sc.nextInt());

                            System.out.print("工资:");
                            customerUpdate.setSalary(sc.nextDouble());
//                            System.out.print("电话:");
 customerUpdate.setPhone(sc.next());

                            customerUpdate.setPhone(user.inputCustomerphonenumber());
                            System.out.print("账号:");
                            customerUpdate.setUser(sc.next());
                            System.out.print("密码:");
                            customerUpdate.setPassword(md5Example.md5(sc.next()));



                            if (customerService.updateCustomer(customerUpdate)){
                                System.out.println("修改成功");
                            }else {
                                System.out.println("修改失败");
                            }
                            break;
                        case 3:
                            System.out.print("要删除的ID:");
                            int id = sc.nextInt();
                            if (customerService.deleteCustomer(id)){
                                System.out.println("删除成功");
                            }else {
                                System.out.println("删除失败");
                            }
//                    break;
//                case 4:
//                    System.out.print("刷新");
//                    main(args);
//                    break;

                    }
                    if (num >= 5 || num <= 0) {
                        System.out.println("----------------------------------------------");
                        System.out.println("非法输入");
                    }
                } while (num != 4);
            }else {
                System.out.println("登录失败,请重新登录");
                main(args);
            }
        }




    }


}
*/
